#ifndef __unp_h
#define __unp_h

#include <sys/types.h>  /* basic system data types */
#include <sys/socket.h> /* basic socket definitions */
#include <sys/time.h>   /* timeval{} for select() */
#include <time.h>       /* timespec{} for pselect() */
#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
#include <arpa/inet.h>  /* inet(3) functions */
#include <errno.h>
#include <fcntl.h>      /* for nonblocking */
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>   /* for S_xxx file mode constants */
#include <sys/uio.h>    /* for iovec{} and readv/writev */
#include <unistd.h>
#include <sys/wait.h>
#include <sys/un.h>     /* for Unix domain sockets */

#include <sys/select.h>

#include <sys/sysctl.h>

#include <poll.h>

// libevent-dev
//#include <sys/event.h>

#include <strings.h>

#include <sys/ioctl.h>

#include <sys/socket.h>

#include <pthread.h>

// libsctp lksctp
//#include <netinet/sctp.h>

#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif

#ifndef SHUT_RD
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
#endif

#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif

#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif

#define bzero(ptr, n) memset(ptr, 0, n)

/* The structure returned by recvfrom_flags() */
struct unp_in_pktinfo
{
    struct in_addr ipi_addr;
    int ipi_ifindex;
};

//#define CMSG_LEN(size) (sizeof(struct cmsghdr) + (size))

//#define CMSG_SPACE(size) (sizeof(struct cmsghdr) + (size))


#define LISTENQ 1024
#define MAXLINE 4096
#define BUFFSIZE 8192

#define SERV_PORT 9877
#define SERV_PORT_STR "9877"
#define UNIXSTR_PATH "/tmp/unix.str"
#define UNIXDG_PATH "/tmp/unix.dg"

#define SA struct sockaddr

//struct timespec
//{
//   time_t tv_sec;
//    long tv_nsec;
//}


#endif
